<?php

namespace Admin\Controller;
//use Think\Controller;
use Tools\AdminController;
class IndexController extends AdminController{
    //头部
   function head(){
       $this->display();
   } 
   //左部
   function left(){
       //根据管理员获得其角色,进而获得角色对应的权限
       //① 根据管理员id信息获得其本身记录信息
       $admin_id = session('admin_id');
       $admin_name = session('admin_name');
       $Manager_info = D('manager')->find($admin_id);
       $role_id = $Manager_info['mg_role_id'];
       
       //②根据$role_id获得本身记录信息
       $role_info = D('Role')->find($role_id);
       $auth_id = $role_info['role_auth_ids'];
       
       //③根据$auth_id获得本身记录信息
       if($admin_name==='admin'){
       $role_infoA = D('Auth')->where("auth_level=0 ")->select();//父级
       $role_infoB = D('Auth')->where("auth_level=1 ")->select();
       }else{
       $role_infoA = D('Auth')->where("auth_level=0 and auth_id in($auth_id)")->select();//父级
       $role_infoB = D('Auth')->where("auth_level=1 and auth_id in($auth_id)")->select();//子级
       }
       $this->assign('auth_infoA',$role_infoA);
       $this->assign('auth_infoB',$role_infoB);
       $this->display();
   } 
   //右部
   function right(){
       S('a','val');
       $value = S('a');
       $this->assign('v',$value);
       $this->display();
   } 
   //索引页(整合 头部 左部 右部)
   function index(){
       $this->display();
   } 
}
